package com.tianji.remark.task;

import com.tianji.remark.domain.dto.LikeRecordFormDTO;
import com.tianji.remark.service.ILikedRecordService;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;

import java.util.List;

@Slf4j
@Component
@RequiredArgsConstructor
public class LikeTask {
    private static final List<String> BIZ_TYPES = List.of("QA", "NOTE");
    private static final int MAX_BIZ_SIZE = 30;
    private final ILikedRecordService recordService;
    //定时任务放入mq发送异步消息
    @Scheduled(fixedDelay = 20000)
    public void likeTask(){
        log.info("定时任务开始执行");
        for (String bizType : BIZ_TYPES) {
            recordService.sendMessage(bizType, MAX_BIZ_SIZE);
        }
    }

}
